import type {
  HotPorduct,
  HotPorductPageParams,
  HotPorductParams,
  HotPorductUpdateSortParams,
  HotPorductUpdateStatusParams,
} from '@/models/hotProduct'
import type { CommonResult, CommonPage } from '@/models/request'
import request, { ContentTypeEnum } from '@/utils/request'
export function fetchList(params: HotPorductPageParams) {
  return request<CommonPage<HotPorduct>>({
    url: '/home/recommendProduct/list',
    method: 'get',
    params: params,
  })
}

export function updateRecommendStatus(data: HotPorductUpdateStatusParams) {
  return request<CommonResult>({
    url: '/home/recommendProduct/update/recommendStatus',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': ContentTypeEnum.form,
    },
  })
}

export function deleteHotProduct(data: { ids: string }) {
  return request<CommonResult>({
    url: '/home/recommendProduct/delete',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': ContentTypeEnum.form,
    },
  })
}

export function createHotProduct(data: HotPorductParams[]) {
  return request<CommonResult>({
    url: '/home/recommendProduct/create',
    method: 'post',
    data: data,
  })
}

export function updateHotProductSort(params: HotPorductUpdateSortParams) {
  return request<CommonResult>({
    url: '/home/recommendProduct/update/sort/' + params.id,
    method: 'post',
    params: params,
    headers: {
      'Content-Type': ContentTypeEnum.form,
    },
  })
}
